Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build chatbot post api #139

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

build chatbot post api #139

wants to merge 3 commits into from

Conversation

chris-t-li
Copy link
Collaborator

  1. Create chatbotApiSlice to that will send a post request to "http://localhost:8000/fitbot/botcomment" where body of the request will be a prompt history which is an array of objects in the following format:
{
    "prompts": [
        {"role": "user", "content": "On 05-May-2023 user1 posted a workout! Run for 20 mins, earning 320 points!"},
        {"role": "user", "content": "On 05-May-2023 user2 posted a workout! Cycle for 45 mins, earning 472 points!"},
        {"role": "user", "content": "On 08-May-2023 user3 posted a workout! Cycle for 133 mins, earning 1396 points!"},
        {"role": "user", "content": "On 11-May-2023 user4 posted a workout! Open Water Swimming for 180 mins, earning 1170 points!"},
        {"role": "user", "content": "On 16-May-2023 user5 posted a workout! Soccer for 90 mins, earning 1260 points!"}
    ]
}
  1. In the Posts component, define the workoutContextArray that will be the array of prompts that is sent to the above endpoint.

  2. In Posts#Controller, add functionality if the params[:post_type] is "bot", the user that is creating the post shall be the bot in the competition

  3. For testing and initial implementation, a "ChatBot" button has been created in Posts with an onClick event that sends a post request to the fantasy_bot_ai api endpoint "/fitbot/comment", which sends a request to openai with the array of prompts, and receives a GPT reply that is sent to the client. The client then renders the response by creating a post/comment generated by the bot participant in the competition

NOTE*
This is currently in testing mode only. Functionality will not work in deployment as fantasy_bot_ai has not yet been deployed. To test this functionality, open https://github.com/Fantasy-Fit/fantasyfit_bot_ai as per instructions in the README
*END

@chris-t-li chris-t-li added enhancement New feature or request functionality labels May 16, 2023
@chris-t-li chris-t-li self-assigned this May 16, 2023
@netlify
Copy link

netlify bot commented May 16, 2023

Deploy Preview for fantasyfit ready!

Name Link
🔨 Latest commit f5cb835
🔍 Latest deploy log https://app.netlify.com/sites/fantasyfit/deploys/646f74069f737e0007ca252e
😎 Deploy Preview https://deploy-preview-139--fantasyfit.netlify.app/
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Collaborator

@dkussainov dkussainov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great Job! Like it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants